<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>智能分班</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width, user-scalable=no">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta name="apple-mobile-web-app-status-bar-style" content="default"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
    <meta content="telephone=no" name="format-detection">
    <meta content="email=no" name="format-detection">
    <meta name="format-detection" content="telephone=no"/>
    <link href="${s.base}/mobile/css/weui.min.css" rel="stylesheet" />
    <link href="${s.base}/mobile/css/jquery-weui.css" rel="stylesheet"/>
    <link href="${s.base}/mobile/css/jquery-weui.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="${s.base}/mobile/css/divideclass/znfb.css"/>

</head>
<body>
<div class="main-content75">
    <div class="search-cont">
        <div class="search-nei">
            <label><i class="cyfont">&#xe653;</i></label>
            <input type="text" id="inputKey" placeholder="请输入关键字搜索" oninput="loadStudent()"/>
        </div>
    </div>
    <div class="select-class-line">
        班级：<i class="cyfont">&#xe6c9;</i><input id="class" type="text" value="" readonly="readonly" />
        <div class="updownbtn"><i class="cyfont">&#xe6aa;</i></div>
    </div>
    <div class="kw-sigin-tab">
        <table>
            <thead>
            <tr>
                <th>学号</th>
                <th>姓名</th>
                <th>性别</th>
                <th>来源学校</th>
            </tr>
            </thead>
            <tbody id="studentList">
            <!--<tr>
                <td>01</td>
                <td>徐小虎</td>
                <td>男</td>
                <td>镜湖小学</td>
            </tr>-->
            </tbody>
        </table>
    </div>

</div>
</body>
<script type="text/javascript" src="${s.base}/mobile/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="${s.base}/mobile/js/jquery-weui.js"></script>
<script type="text/javascript" src="${s.base}/mobile/js/fontSize.js"></script>
<script type="text/javascript" src="${s.base}/mobile/js/common.js"></script>
<script type="text/javascript">
    var classList = JSON.parse('${classList}');
    var checkClassId = '';
    $(function () {
        initListener();
        loadStudent();
    });

    function initListener() {
        if(classList && classList.length>0){
            checkClassId = classList[0].value;
            $("#class").val(classList[0].title);
        }
        $("#class").select({
            title: "选择班级",
            items: classList,
            closeText:"关闭",
            onChange: function(d) {
                console.log(this, d);
            },
            onClose: function(d,element) {
                checkClassId = d.data.values;
                loadStudent();
            },
            onOpen: function() {
                console.log("open");
            },
        });
    }

    function loadStudent() {
        /*if(isBlank(checkClassId)){
            //$.toast('请先选择班级', "text");
            return false;
        }*/
        $.fn.doPost('/phone/divideclassStudent/getDivideclassStudent', {classId: checkClassId,name:$("#inputKey").val()}, function (result) {
            if (result.code === 0) {
                var str = '';
                var data = result.data;
                if (data != null && data.length > 0) {
                    for (var i = 0; i < data.length; i++) {
                        var e = data[i];
                        str += '<tr>'+
                            '<td>'+e.xh+'</td>'+
                            '<td>'+e.name+'</td>'+
                            '<td>'+(e.sex=='1'?'男':'女')+'</td>'+
                            '<td>'+e.school+'</td>'+
                            '</tr>';
                    }
                }
                if (isBlank(str)) {
                    //$('.nodate-ctn').show();
                    $('#studentList').html(str);
                } else {
                    $('#studentList').html(str);
                }
            } else {
                $.toast('获取数据失败', "text");
            }
        });
    }


</script>
</html>
